package internal

import (
	"base"
	"center_server/chanrpc"
	. "center_server/internal"
	"center_server/logic"
	"leaf/gate"
	"math"
)

type Module struct {
	*gate.Server
}

func (m *Module) OnPrepare() {
	server := new(gate.Server)
	server.MaxConnNum = math.MaxUint16
	server.PendingWriteNum = PendingWriteNum
	server.MaxMsgLen = MaxMsgLen
	server.Processor = base.Processor

	server.TCPAddr = Config.TcpAddr
	server.LenMsgLen = LenMsgLen
	server.LittleEndian = base.LittleEndian
	server.NewTcpAgent = chanrpc.NewAgent
	server.CloseTcpAgent = chanrpc.CloseAgent

	m.Server = server
}

func (m *Module) OnInit() {
	m.Server.AgentChanRPC = logic.ChanRpc
}
